import React from 'react';
import './App.css';
import RelayRequest from './server/RelayRequest'
import getData from './server/GetData'
import { HashRouter as Router, Route, Redirect } from 'react-router-dom'
import Questionnaire from './Pages/Questionnaire/'
import QuestInfo from './Pages/QuestInfo/'
import QuestComp from './Pages/QuestComplaint/'
import QuestEntry from './Pages/QuestEntry/'
import QuestUser from './Pages/QuestUser/'
import Result from './Pages/Result/'
import Guide from './Pages/Guide/'

// 请求拦截
getData.interceptors.request.use(
  config => {
    config.data = RelayRequest(config.data) // 按照平台签名规则处理入参
    return config
  }
)

// 响应拦截
getData.interceptors.response.use(
  config => {
    return config.data
  }
)

function App() {
  return (
    <Router>
      {/* <Redirect from="/" to="/questEntry" /> */}
      {/* 入口页 */}
      <Route path="/questEntry" component={QuestEntry}/>
      {/* 投诉 */}
      <Route path="/questComp" component={QuestComp}/>
      {/* 满意度信息 */}
      <Route path="/questInfo" component={QuestInfo}/>
      {/* 满意度类型 */}
      <Route path="/questUser" component={QuestUser}/>
      {/* 满意度详情 */}
      <Route path="/questionnaire" component={Questionnaire}/>
      {/* 反馈结果页 */}
      <Route path="/result" component={Result}/>
      {/* 引导页 */}
      <Route path="/guide" component={Guide}/>
    </Router>
  );
}

export default App;
